<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    function getNums36() {
        let arr = []
        for (let i = 0; i < 36; i++) {
            if (i >= 0 && i <= 9) {
                arr.push(i)
            } else {
                arr.push(String.fromCharCode(87 + i))
            }
        }
        return arr
    }

    function scale36(n) {
        const arr = [];
        var nums36 = getNums36();
        if (!Number.isInteger(n)) {//浮点数判断，目前不支持小鼠
            console.warn('不支持小数转换');
            return n;
        }
        var neg = '';
        //对负数的处理
        if (n < 0) {
            neg = '-';
            n = Math.abs(n)
        }
        while (n) {
            var res = n % 36;
            arr.unshift(nums36[res]);
            // 进位
            n = parseInt(n / 36);
        }
        arr.unshift(neg)
        return arr.join("");

    }
    console.log(scale36(3678))
</script>

</html>